<template>
    <v-btn id="common-copy-btn" :data-clipboard-text="content">{{buttonName}}</v-btn>
</template>

<script>
    import ClipboardJS from 'clipboard'

    export default {
        name: "CopyButton",
        props: {
            content: String,
            buttonName: {
                type: String,
                default: '复制到剪贴板'
            }
        },
        mounted() {
            const clipboard = new ClipboardJS('#common-copy-btn');
            // clipboard.on('success', function(e) {
            //     console.info('Action:', e.action);
            //     console.info('Text:', e.text);
            //     console.info('Trigger:', e.trigger);
            //     e.clearSelection();
            // });
            // clipboard.on('error', function(e) {
            //     console.error('Action:', e.action);
            //     console.error('Trigger:', e.trigger);
            // });
        }
    }
</script>

<style scoped>

</style>
